package com.example.demo1.twd.bean;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class Children extends Father{
    @Override
    public void method(){

    }
    public static void main(String[] args) {
        Class<Father> fatherClass = Father.class;
        Class<Children> childrenClass = Children.class;
//        fatherClass.getDeclaredFields()
        System.out.println("类：");
        for (Annotation annotation : fatherClass.getAnnotations()) {
            System.out.println(annotation.toString());
        }
        System.out.println("属性：");
        for (Field field : fatherClass.getDeclaredFields()) {
            for (Annotation annotation : field.getAnnotations()) {
                System.out.println(annotation.toString());
            }
        }
        System.out.println("方法：");
        for (Method field : fatherClass.getDeclaredMethods()) {
            for (Annotation annotation : field.getAnnotations()) {
                System.out.println(annotation.toString());
            }
        }
        System.out.println("======================================================");
        System.out.println("类：");
        for (Annotation annotation : childrenClass.getAnnotations()) {
            System.out.println(annotation.toString());
        }
        System.out.println("属性：");
        for (Field field : childrenClass.getDeclaredFields()) {
            for (Annotation annotation : field.getAnnotations()) {
                System.out.println(annotation.toString());
            }
        }
        System.out.println("方法：");
        for (Method field : childrenClass.getMethods()) {
            for (Annotation annotation : field.getAnnotations()) {
                System.out.println(annotation.toString());
            }
        }

    }
}
